﻿#region Opis pliku
//-----------------------------------------------------------------------------
// OptionsMenu.cs
// Autor: Jan Czarnowski
// 9.11.2012
//-----------------------------------------------------------------------------
#endregion

#region Using...

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System.Diagnostics;
using System.Collections.Generic;
using System;

#endregion

namespace pogra
{
    /// <summary>
    /// Klasa reprezentująca menu opcji
    /// </summary>
    class OptionsMenu : Menu
    {
        Menu menu;
        MenuItem fsButton;

        #region inicjalizacja

        public OptionsMenu(Menu menu)
        {
            this.menu = menu;
            title = "{ Options }";
        }

        public override void LoadContent()
        {
            Rectangle viewport = ScreenManager.Game.GraphicsDevice.Viewport.Bounds;
            Pos = new Vector2(viewport.Width/2, viewport.Height/2) + new Vector2(120, 0);

            int menuItemHeight = 30;
            int menuItemWidth = menuRect.Width;

            fsButton = new MenuItem("Toggle fullscreen", new Rectangle(menuRect.Left, dragRect.Bottom, menuRect.Width, menuItemHeight), this);
            MenuItem optionsItem = new MenuItem("Option 2", new Rectangle(menuRect.Left, dragRect.Bottom + menuItemHeight, menuRect.Width, menuItemHeight), this);
            MenuItem quitItem = new MenuItem("Option 3", new Rectangle(menuRect.Left, dragRect.Bottom + 2 * menuItemHeight, menuRect.Width, menuItemHeight), this);

            itemList.Add(fsButton);
            itemList.Add(optionsItem);
            itemList.Add(quitItem);

            loaded = true;
        }

        #endregion

        #region metody publiczne

        protected override void handleButtons(string pressedText)
        {
            switch (pressedText)
            {
                case "Toggle fullscreen":
                    ((RTSGame) ScreenManager.Game).GraphicsManager.ToggleFullScreen();
                    break;
            }
        }
        #endregion
    }
}
